<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitDanmu extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('danmus', function (Blueprint $table) {
            $table->comment = '弹幕表';

            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->integer('user_id')->nullable()->index()->comment('用户id');

            $table->string('user_name', 20)->nullable()->comment('用户姓名');
            $table->char('user_headimg')->nullable()->comment('用户头像');

            $table->string('text', 50)->nullable()->comment('指定弹幕内容');

            $table->tinyInteger('source_type')->index()->comment('1为用户抽盒数据 2为模拟数据');
            $table->integer('mock_number')->nullable()->index()->comment('模拟数据的批次');

            $table->char('node_type', 30)->nullable()->index()->comment('节点类型');
            $table->uuid('node_uuid')->nullable()->index()->comment('节点uuid');
            $table->integer('node_id')->nullable()->index()->comment('节点id');
            $table->integer('sku_id')->nullable()->index()->comment('sku id');
            $table->string('sku_title')->nullable()->comment('sku 标题');

            $table->timestamp('emited_at')->index()->comment('触发时间');

            $table->tinyInteger('is_special_sku')->default(0)->index()->comment('是否特别款'); 

            $table->integer('list_weight')->default(100)->index()->comment('列表权重');
            $table->tinyInteger('status')->default(1)->index()->comment('0为未上架 1为已上架 '); // 0为未上架 1为已上架 

            $table->softDeletes();
            $table->timestamps();
            
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('danmus');
    }
}
